import React, {Component} from 'react'

import Ajax from 'src/assets/js/fetch'
import {GETRECOMENDLIST} from "../const/shareUri";

import 'src/styles/zetianshuo.less'

export default class Zetianshuo extends Component {
  constructor() {
    super();
    this.state = {
      list: []
    }
  }

  componentDidMount() {
    this._getList()
  }


  List = () => {
    return this.state.list.map((item, index) =>
        <div onClick={() => {
          console.log(this)
        }} key={index} className="z_t_s_list">
          <div className="imgBox">
            <img src={item.recommendPagePic2} alt=""/>
          </div>
          <div>
            <p className="title">
              {item.title}
            </p>
            <p className="subTitle">
              {item.subTitle}
            </p>
          </div>
        </div>
    )
  }

  render() {
    return (
        <div id='zetianshuo' className=' padding-bottom-49'>
          {this.List()}
        </div>
    )
  }

  _getList() {
    Ajax.get(GETRECOMENDLIST, {}, res => {
      this.setState({
        list: res.data
      });
      console.log(this.state.list);
    })
  }
}